﻿@model DPUWebPhet10.Models.Report03ModelCriteria
@using DPUWebPhet10.Helpers
@using PagedList.Mvc;
@{
    ViewBag.Title = "ตรวจสอบรายชื่อผู้สมัคร";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
                //var grid = new WebGrid(Model.reports, rowsPerPage: 10, ajaxUpdateContainerId: "worksajaxgrid", ajaxUpdateCallback: "ajaxUpdate_Callback");
    <!-- Content -->


    <!-- Box Head -->
    <div class="box-head">
        <br />
        <div class="condition">
            @using (Html.BeginForm("Report03", "Report"))
            {
                <table>
                    <tr>
                        <td style="text-align: right">
                            @Html.Label("เลือกระดับชั้น")
                        </td>
                        <td>
                            <!-- Student level -->
                            @if (@HttpContext.Current.Session["PhetCulture"].ToString().Equals("en"))
                            {                

                                @Html.DropDownListFor(model => model.studentLevel, new SelectList(
                      new List<Object>{ 
                           new { value = 0 , text = "-- All --"  },
                           new { value = 1 , text = "Level 1 Grade 1-3"  },
                           new { value = 2 , text = "Level 2 Grade 4-6" },
                           new { value = 3 , text = "Level 3 Grade 7-9"},
                           new { value = 4 , text = "Level 4 Grade 10-12"},
                           new { value = 5 , text = "University Education"}
                        },
                      "value",
                      "text",
                            0), new { style = "width: 142px" })
                            }
                            else
                            { 
                                @Html.DropDownListFor(model => model.studentLevel, new SelectList(
                      new List<Object>{ 
                           new { value = 0 , text = "-- ทั้งหมด --"  },
                           new { value = 1 , text = "ช่วงชั้นที่ 1 ประถมศึกษาปีที่ 1-3"  },
                           new { value = 2 , text = "ช่วงชั้นที่ 2 ประถมศึกษาปีที่ 4-6" },
                           new { value = 3 , text = "ช่วงชั้นที่ 3 มัธยมศึกษาปีที่ 1-3"},
                           new { value = 4 , text = "ช่วงชั้นที่ 4 มัธยมศึกษาปีที่ 4-6"},
                           new { value = 5 , text = "อุดมศึกษา"}
                        },
                      "value",
                      "text",
                                 0), new { style = "width: 200px" })
                            }
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right">
                            @Html.Label("สถาบัน")
                        </td>
                        <td>
                            @Html.TextBoxFor(model => model.schoolName, new { style = "width: 300px" })
                        </td>
                        <td>
                            <input type="submit" class="button" value="ค้นหา" style="width: 50px" />
                        </td>
                        <td>@DPUWebPhet10.Resources.Application.Application.REGISETER_VALIDATE_MSG01
                        </td>
                    </tr>
                </table>
            }
        </div>
        <br />
    </div>
    <div class="table" id="gridContent">
        @if (Model.reports != null && Model.reports.Count > 0)
        {
            if (Model.reports.Count == 0)
            {
            <!-- Not found data -->
            <div style="text-align: center; color: Red">
                <h2>
                    @Html.Label("ไม่พบข้อมูล")
                </h2>
            </div>             
             
            }
            else
            {   
            <table width="100%">
                <thead>
                    <tr>
                        <th>
                            ลำดับ
                        </th>
                        <th>
                            ชื่อ - นามสกุล
                        </th>
                        <th>
                            สถาบัน
                        </th>
                        <th>
                            ประเภทโรงเรียน
                        </th>
                        <th>
                            จังหวัด
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var result in Model.reports)
                    {
                        <tr>
                            <td>
                                @result.seq
                            </td>
                            <td>@result.fullName
                            </td>
                            <td>@result.school
                            </td>
                            <td>@result.schoolType
                            </td>
                            <td>@result.province
                            </td>
                        </tr>

                    }
                </tbody>

            </table>
                                        @Html.PagedListPager(Model.reports,
            page => Url.Action("Report03", new RouteValueDictionary() {
               { "Page", page }, { "schoolName", Model.schoolName }, { "studentLevel", Model.studentLevel }
            }),
            PagedListRenderOptions.MinimalWithPageCountText)
            }
        }
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
    </div>


    <!-- End Content -->


    
}
@section Scripts {
    <script type="text/javascript">
        $(document).ready(function () {
        });
    </script>
}
